<template>
  <div class="center">
    <!-- 头部 -->
    <div class="table_header flex flex_bet flex-wrap">
      <div class="table_button">
        <el-button type="primary" icon="el-icon-refresh" size="mini" @click="Refresh"></el-button>
        <el-button type="primary" icon="el-icon-plus" size="mini" @click="btnaddBrand">添加</el-button>
      </div>
      <div class="table_searchs flex felx_align">
        <div class="table_search flex">
          <el-input placeholder="搜索" v-model="searchTable" class="input-with-select" size="small">
            <el-select v-model="select" slot="prepend" placeholder="请选择" class="table_select" style="width:105px">
              <el-option label="型号代码" value="1"></el-option>
              <el-option label="英文编码" value="2"></el-option>
            </el-select>
            <el-button slot="append" icon="el-icon-search" @click="idnameSearch"></el-button>
          </el-input>
        </div>
        <dynamicTable :checkboxVal="checkboxVal" @alter="alterCheckbok" />
      </div>
    </div>
    <!-- 专题管理table -->
    <el-table stripe :data="brandTable" style="width: 100%" :key="key" border fit highlight-current-row ref="tableDataRef">
      <el-table-column v-if="colData[0].istrue" prop="name" label="型号" min-width="100" align="center"></el-table-column>
      <el-table-column v-if="colData[1].istrue" prop="tNameCode" label="第三/四位" min-width="100" align="center"></el-table-column>
      <el-table-column v-if="colData[2].istrue" prop="name_code" label="英文编码" min-width="100" align="center"></el-table-column>
      <el-table-column v-if="colData[3].istrue" prop="remarks" label="简述" min-width="140" align="center"></el-table-column>
      <el-table-column v-if="colData[4].istrue" prop="firmware_version" label="最新固件版本号" min-width="120" align="center"></el-table-column>
      <el-table-column v-if="colData[5].istrue" prop="firmware_address" label="最新固件下载地址" min-width="120" align="center">
        <template slot-scope="scope">
          <div @click="firmwareDownload(scope.row.firmware_address)">{{scope.row.firmware_address}}
            <el-button size="mini" type="text" icon="el-icon-download"></el-button>
          </div>
        </template>
      </el-table-column>
      <el-table-column v-if="colData[6].istrue" prop="username" label="创建者" min-width="120" align="center"></el-table-column>
      <el-table-column v-if="colData[7].istrue" prop="create_time" label="创建时间" min-width="140" align="center">
        <template slot-scope="scope">{{scope.row.create_time| newDate}}</template>
      </el-table-column>
      <el-table-column v-if="colData[8].istrue" prop="update_time" label="更新时间" min-width="140" align="center">
        <template slot-scope="scope">{{scope.row.update_time| newDate}}</template>
      </el-table-column>
      <el-table-column label="操作" min-width="180" align="center">
        <template slot-scope="scope">
          <el-row>
            <el-button v-permission="['超级管理员', '生产管理员']" size="mini" type="primary" @click="getDigitsFiveDetaileds(scope.row)">编辑</el-button>
            <el-button v-permission="['超级管理员']" size="mini" @click="getdeleteBrowser(scope.row.id)">删除</el-button>
            <el-button size="mini" type="primary" @click="getexportDigitsFive(scope.row.id)">导出</el-button>
          </el-row>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <div class="paging">
      <el-pagination :current-page.sync="listQuery.startSize" :page-sizes="[10, 50, 100, 200]" :page-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" background
        @size-change="handleSizeChange" @current-change="handleCurrentChange"></el-pagination>
    </div>
    <!-- 添加应用专题 -->
    <el-dialog :title="editSubjects ? 'SN生成规则' : '编辑'" :visible.sync="dialogFormVisible" @close="addFormclose" :close-on-click-modal="false" :close-on-press-escape="false" width="60%">
      <el-form :model="addForm" ref="ruleForm" :rules="rules" class="diolog_adapt">
        <el-form-item label="第三/四位:" label-width="100px" prop="digitsId" v-if="editSubjects">
          <el-select v-model="addForm.digitsId" placeholder="没有选中任何项" @change="getdigitsThereGetFirmware">
            <el-option v-for="item in lotoptions" :key="item.id" :label="`${item.name_code} : ${item.name}`" :value="item.id"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="第五位" label-width="100px" prop="nameCode">
          <el-input v-model="addForm.nameCode" autocomplete="off" placeholder="请输入第五位英文编码" :disabled="!editSubjects"></el-input>
        </el-form-item>
        <el-form-item label="简述" label-width="100px" prop="remarks">
          <el-input v-model="addForm.remarks" type="textarea" autocomplete="off" placeholder="请输入简述" maxlength="50" show-word-limit></el-input>
        </el-form-item>
        <div class="flex  felx_align">
          <el-form-item label="IMEI个数" label-width="100px" prop="imei_count" style="min-width:20%">
            <!-- <el-input v-model="addForm.supplier.cpu" autocomplete="off" placeholder="IEMI个数" class="mar_top"></el-input> -->
             <el-select v-model="addForm.imei_count" placeholder="请选择活动区域">
                <el-option label="0" value="0"></el-option>
                <el-option label="1" value="1"></el-option>
                <el-option label="2" value="2"></el-option>
                <el-option label="3" value="3"></el-option>
                <el-option label="4" value="4"></el-option>
              </el-select>
          </el-form-item>
          <el-form-item label="IMEI前8位" label-width="100px" prop="imei_prefix" style="min-width:20%">
            <el-input v-model.trim="addForm.imei_prefix" autocomplete="off" oninput="value=value.replace(/[^\d]/g,'')" placeholder="请输入八位数字" maxlength="8" :disabled="addForm.imei_count > 0 ? false : true"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align">
          <el-form-item label="CPU" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.cpu" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="addForm.supplier.cpu" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.cpu" style="min-width:30%">
            <el-input v-model="addForm.detailed.cpu" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align ">
          <el-form-item label="运行RAM" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.start_ram" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.start_ram" style="min-width:30%">
            <el-input v-model="addForm.supplier.start_ram" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.start_ram" style="min-width:30%">
            <el-input v-model="addForm.detailed.start_ram" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align">
          <el-form-item label="存储ROM" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.storage_rom" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.storage_rom" style="min-width:30%">
            <el-input v-model="addForm.supplier.storage_rom" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.storage_rom" style="min-width:30%">
            <el-input v-model="addForm.detailed.storage_rom" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align">
          <el-form-item label="显示屏" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.display" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.display" style="min-width:30%">
            <el-input v-model="addForm.supplier.display" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.display" style="min-width:30%">
            <el-input v-model="addForm.detailed.display" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align">
          <el-form-item label="触摸屏" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.touch_screen" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.touch_screen" style="min-width:30%">
            <el-input v-model="addForm.supplier.touch_screen" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.touch_screen" style="min-width:30%">
            <el-input v-model="addForm.detailed.touch_screen" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align">
          <el-form-item label="前摄像头" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.prefix_camera" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.prefix_camera" style="min-width:30%">
            <el-input v-model="addForm.supplier.prefix_camera" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.prefix_camera" style="min-width:30%">
            <el-input v-model="addForm.detailed.prefix_camera" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align">
          <el-form-item label="后摄像头" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.suffix_camera" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.suffix_camera" style="min-width:30%">
            <el-input v-model="addForm.supplier.suffix_camera" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.suffix_camera" style="min-width:30%">
            <el-input v-model="addForm.detailed.suffix_camera" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align">
          <el-form-item label="电池" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.battery" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.battery" style="min-width:30%">
            <el-input v-model="addForm.supplier.battery" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.battery" style="min-width:30%">
            <el-input v-model="addForm.detailed.battery" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
        <div class="flex flex_bet felx_align">
          <el-form-item label="其他需求" label-width="100px" prop="supplier.cpu" style="min-width:30%">
            <el-input v-model="FirmwareDate.other" autocomplete="off" placeholder="请输入供应商" class="" disabled></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="supplier.other" style="min-width:30%">
            <el-input v-model="addForm.supplier.other" autocomplete="off" placeholder="请输入供应商" class="mar_top"></el-input>
          </el-form-item>
          <el-form-item label-width="100px" prop="detailed.other" style="min-width:30%">
            <el-input v-model="addForm.detailed.other" autocomplete="off" placeholder="请输入规格" class="mar_top"></el-input>
          </el-form-item>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogFormVisible = false" size="mini" round>取 消</el-button>
        <el-button v-if="editSubjects" type="primary" @click="getaddCreateDigitsFive('ruleForm')" size="mini" round>确 定</el-button>
        <el-button v-else type="primary" @click="getupdateDigitsFive('ruleForm')" size="mini" round>编辑</el-button>
      </div>
    </el-dialog>
    <delete-Dialog title="" :visible.sync="deleteDialogs.show" width="25%" top="40vh" @deleteEvents="deleteEvents" :deleteText="deleteDialogs.deleteText" />
  </div>
</template>

<script>
import dynamicTable from "@/components/DynamicTable";
import objectable from "@/utils/objectable.js";
import deleteDialog from "@/components/deleteDialog";
import permission from '@/directive/permission/index.js' // 权限判断指令
import { getCreateDigits, getDigitsFive, addCreateDigitsFive, getDigitsFiveDetailed, updateDigitsFive, digitsThereGetFirmware, deleteSnDigitsFive, exportDigitsFive } from "@/api/snControl.js";
export default {
  directives: { permission },
  components: { dynamicTable, deleteDialog },
  data() {
    return {
      checkboxVal: ['型号', '第三/四位', '英文编码', '简述', '最新固件版本号', '最新固件下载地址', '创建者', '创建时间', '更新时间'],
      key: 1,
      colData: [],//动态控制table
      brandTable: [],
      select: "", //搜索条件
      searchTable: "",
      total: 0, //总数量
      //批次下拉选择
      lotoptions: [],
      //添加按钮控制
      dialogFormVisible: false,
      //编辑按钮控制
      editSubjects: true,
      //编辑专题id
      subjectId: 0,
      listQuery: { startSize: 1, pageSize: 10, tNameCode: undefined, nameCode: undefined, },
      //添加表单
      addForm: {
        userId: localStorage.getItem("ID"), last_ip: sessionStorage.getItem("Ip"), digitsId: '', nameCode: '', remarks: '',imei_count:0,imei_prefix:'',
        supplier: { cpu: '', start_ram: '', storage_rom: '', display: '', touch_screen: '', prefix_camera: '', suffix_camera: '', battery: '', other: '' },
        detailed: { cpu: '', start_ram: '', storage_rom: '', display: '', touch_screen: '', prefix_camera: '', suffix_camera: '', battery: '', other: '' }
      },
      rules: {
        digitsId: [{ required: true, message: "请选择第三/四位", trigger: "blur" }],
        nameCode: [{ required: true, message: "请输入第五位英文编码", trigger: "blur" }],
        imei_count: [{ required: true, message: "请选择IMEI个数", trigger: "blur" }],
        // imei_prefix: [{ validator: imeiRules, trigger: 'blur'},{min:8, max: 8, message: ' IMEI输入位数不正确', trigger: 'blur' }],
        imei_prefix: [{ required: true, message: "请输入IMEI号", trigger: "blur" },{min:8, max: 8, message: ' IMEI输入位数不正确', trigger: 'change' }],
        'supplier.cpu': [{ required: true, message: "请输入CPU", trigger: "blur" }, { max: 50, message: '最多输入50位', trigger: 'blur' }],
        'supplier.start_ram': [{ required: true, message: "请输入运行RAM", trigger: "blur" }, { max: 50, message: '最多输入50位', trigger: 'blur' }],
        'supplier.storage_rom': [{ required: true, message: "请输入存储ROM", trigger: "blur" }, { max: 50, message: '最多输入50位', trigger: 'blur' }],
        'supplier.display': [{ required: true, message: "请输入显示屏", trigger: "blur" }, { max: 50, message: '最多输入50位', trigger: 'blur' }],
        'supplier.touch_screen': [{ required: true, message: "请输入触摸屏", trigger: "blur" }, { max: 50, message: '最多输入50位', trigger: 'blur' }],
        'supplier.prefix_camera': [{ required: true, message: "请输入前摄像头", trigger: "blur" }],
        'supplier.suffix_camera': [{ required: true, message: "请输入后摄像头", trigger: "blur" }],
        'supplier.battery': [{ required: true, message: "请输入电池", trigger: "blur" }],
        'supplier.other': [{ required: true, message: "请输入其他特殊需求", trigger: "blur" }],
        'detailed.cpu': [{ required: true, message: "请输入CPU", trigger: "blur" }, { max: 200, message: '最多输入200位', trigger: 'blur' }],
        'detailed.start_ram': [{ required: true, message: "请输入运行RAM", trigger: "blur" }, { max: 200, message: '最多输入200位', trigger: 'blur' }],
        'detailed.storage_rom': [{ required: true, message: "请输入存储ROM", trigger: "blur" }, { max: 200, message: '最多输入200位', trigger: 'blur' }],
        'detailed.display': [{ required: true, message: "请输入显示屏", trigger: "blur" }, { max: 200, message: '最多输入200位', trigger: 'blur' }],
        'detailed.touch_screen': [{ required: true, message: "请输入触摸屏", trigger: "blur" }, { max: 200, message: '最多输入200位', trigger: 'blur' }],
        'detailed.prefix_camera': [{ required: true, message: "请输入前摄像头", trigger: "blur" }],
        'detailed.suffix_camera': [{ required: true, message: "请输入后摄像头", trigger: "blur" }],
        'detailed.battery': [{ required: true, message: "请输入电池", trigger: "blur" }],
        'detailed.other': [{ required: true, message: "请输入其他特殊需求", trigger: "blur" }],
        remarks: [{ required: true, message: "请输入简述", trigger: "blur" }],
      },
      FirmwareDate: {},
      deleteDialogs: { show: false, deleteText: '', deleteId: 0, sn: '' }
    }
  },
  watch:{
    //监听imei个数如果为0则去掉效验即可
    'addForm.imei_count':{
      handler(NewVal,OldVal){
        if(NewVal == 0){
          this.rules.imei_prefix=[]
          this.addForm.imei_prefix = ''
          // this.$refs.ruleForm.clearValidate();
          // 清空单个输入框，最主要的是找到这个field
          let fields = this.$refs['ruleForm'].fields
          for (let i = 0; i < fields.length; i++) {
            if (fields[i].prop === 'imei_prefix') {
              // 通过唯一的prop属性值相同来判别是哪个输入框
              fields[i].resetField()
              break
            }
          }
        }else if(NewVal > 0){
          // this.rules.imei_prefix = [{ required: true, message: "请输入IMEI号", trigger: "change" },{min:8, max: 8, message: ' IMEI输入位数不正确', trigger: 'change' }]
          this.rules.imei_prefix = [{ required: true, message: "请输入IMEI号", trigger: "blur" }]
        }
      }
    },
    'addForm.imei_prefix':{
      handler(NewVal,OldVal){
        if(NewVal > 0){
          this.rules.imei_prefix = [{ required: true, message: "请输入IMEI号", trigger: "blur" },{min:8, max: 8, message: ' IMEI输入位数不正确', trigger: 'change' }]
        }
        
      }
    }
  },
  created() {
    this.colData = objectable(this.checkboxVal, this.checkboxVal);//转为数组对象，好控制table
    this.getDigitsFives()
    this.getCreateDigitss(3)
  },
  methods: {
    firmwareDownload(url) {
      window.open(url)
    },
    getdeleteBrowser(id) {
      this.deleteDialogs.show = true
      this.deleteDialogs.deleteId = id
    },
    //删除按钮事件
    deleteEvents() {
      let params = { userId: localStorage.getItem("ID"), id: this.deleteDialogs.deleteId }
      deleteSnDigitsFive(params).then(res => {
        this.$message.success(res.msg)
        this.getDigitsFives()
      })
    },
    //三四位查询
    getdigitsThereGetFirmware(val) {
      digitsThereGetFirmware({ thereId: val }).then(({ data }) => {
        this.FirmwareDate = data
      }).catch(err => {
        this.$message.error(err.msg)
        this.FirmwareDate = {}
      })
    },
    //根据ID查询信息
    getDigitsFiveDetaileds(row) {
      this.editSubjects = false
      this.subjectId = row.id
      getDigitsFiveDetailed({ id: row.id }).then(res => {
        this.dialogFormVisible = true
        let data = res.data
        console.log('数据', data)
        this.addForm.nameCode = data.name_code
        this.addForm.imei_count = data.imei_count
        this.addForm.imei_prefix = data.imei_prefix
        this.addForm.supplier.cpu = data.sCpu
        this.addForm.supplier.start_ram = data.sStartRam
        this.addForm.supplier.storage_rom = data.sStorageRom
        this.addForm.supplier.display = data.sDisplay
        this.addForm.supplier.touch_screen = data.sTouchScreen
        this.addForm.supplier.prefix_camera = data.sPrefixCamera
        this.addForm.supplier.suffix_camera = data.sSuffixCamera
        this.addForm.supplier.battery = data.sBattery
        this.addForm.supplier.other = data.sOther
        this.addForm.detailed.cpu = data.dCpu
        this.addForm.detailed.start_ram = data.dStartRam
        this.addForm.detailed.storage_rom = data.dStorageRom
        this.addForm.detailed.display = data.dDisplay
        this.addForm.detailed.touch_screen = data.dTouchScreen
        this.addForm.detailed.prefix_camera = data.dPrefixCamera
        this.addForm.detailed.suffix_camera = data.dSuffixCamera
        this.addForm.detailed.battery = data.dBattery
        this.addForm.detailed.other = data.dOther
        this.addForm.remarks = data.remarks
        this.FirmwareDate = {
          cpu: data.eCpu,
          start_ram: data.eStartRam,
          storage_rom: data.eStorageRom,
          display: data.eDisplay,
          touch_screen: data.eTouchScreen,
          prefix_camera: data.ePrefixCamera,
          suffix_camera: data.eSuffixCamera,
          battery: data.eBattery,
          other: data.eOther
        }
      }).catch(err => {
        console.log("请求失败", err);
      })
    },
    //修改信息
    getupdateDigitsFive(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          let addForm = JSON.parse(JSON.stringify(this.addForm))
          delete addForm.digitsId
          addForm.supplier = JSON.stringify(this.addForm.supplier)
          addForm.detailed = JSON.stringify(this.addForm.detailed)
          addForm.id = this.subjectId
          updateDigitsFive(addForm).then(res => {
            this.$message.success(res.msg)
            this.getDigitsFives()
            this.dialogFormVisible = false
          }).catch(err => { })
        } else {
          return false
        }
      })
    },
    //添加成功后清空值

    //添加SN第五位数
    getaddCreateDigitsFive(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          let addForm = JSON.parse(JSON.stringify(this.addForm))
          addForm.supplier = JSON.stringify(this.addForm.supplier)
          addForm.detailed = JSON.stringify(this.addForm.detailed)
          addCreateDigitsFive(addForm).then(res => {
            this.$message.success(res.msg)
            this.getDigitsFives()
            this.dialogFormVisible = false
            this.$refs.ruleForm.resetFields();
          }).catch(err => { })
        } else {
          return false
        }
      })
    },
    btnaddBrand() {
      this.editSubjects = true
      this.dialogFormVisible = true
    },
    //获取1、2、3位数信息
    getCreateDigitss(type) {
      getCreateDigits({ type: type }).then(res => {
        this.lotoptions = res.data
      }).catch(err => {
        this.lotoptions = []
      })
    },
    getDigitsFives() {
      getDigitsFive(this.listQuery).then(res => {
        this.brandTable = res.data
        this.total = res.total
      }).catch(err => {
        this.brandTable = []
        this.total = 0
      })
    },
    //分页
    handleSizeChange(val) {
      this.listQuery.pageSize = val
      this.getDigitsFives();
    },
    handleCurrentChange(val) {
      this.listQuery.startSize = val
      this.getDigitsFives();
    },
    //搜索,1，专题名称
    idnameSearch() {
      if (!this.select) return this.$message.warning("请先选择查询条件");
      this.listQuery.startSize = 1
      this.listQuery.pageSize = 10
      switch (this.select) {
        case '1':
          this.listQuery.tNameCode = this.searchTable
          this.getDigitsFives();
          break;
        case '2':
          this.listQuery.nameCode = this.searchTable
          this.getDigitsFives();
          break;
      }
    },
    Refresh() {
      this.listQuery = { startSize: 1, pageSize: 10, tNameCode: undefined, nameCode: undefined, }
      this.getDigitsFives()
    },
    //表单关闭事件
    addFormclose() {
      if (this.editSubjects === false) {
        this.$nextTick(() => {
          this.$refs["ruleForm"].resetFields();
          this.addForm = this.$options.data().addForm
          this.FirmwareDate = {}
        })
      }
    },
    //下拉动态table子组件
    alterCheckbok(key, conte) {
      this.key = key;
      this.colData.filter(i => {
        if (conte.indexOf(i.title) != -1) {
          i.istrue = false;
          this.$nextTick(() => {
            this.$refs.tableDataRef.doLayout();
          });
        } else {
          i.istrue = true;
          this.$nextTick(() => {
            this.$refs.tableDataRef.doLayout();
          });
        }
      });
    },
    //导出
    getexportDigitsFive(id) {
      exportDigitsFive({ userId: localStorage.getItem("ID"), id: id }).then(res => {
        console.log('------', res)
        window.open(`https://${res.data.url}`)
      })
    }
  }
}
</script>

<style scoped>
.add_input {
  width: 45%;
}
</style>